var Koa = require('koa');
var Router = require('koa-router');

var app = new Koa();
var router = new Router();

router
  .get('/',async (ctx) => {
    console.log(ctx.query);
    ctx.body="首页";
  })
  .get('/news',async (ctx)=>{
    ctx.body="新闻页";
  })
  .get('/detail/:id',async (ctx)=>{
    console.log(ctx.params);
    ctx.body="新闻详情页";
  });

app
  .use(router.routes())
  .use(router.allowedMethods());


app.listen(3000,()=>{
  console.log('服务器启动成功');
})